/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sqlgenerators.search;

import entities.Search;
import entities.SearchLanguageInfoRequerimentOrOperator;

/**
 *
 * @author damfercer
 */
public class LanguageOrResitrictionsSQLGenerator implements SearchSqlGeneratorInterface{
    private String res;
    @Override
    public String getSqlFromSearch(Search search) {
        res="";
//        res+=" AND(";
//        if(search.getSearchLanguageInfoRequerimentOrOperatorList().isEmpty()){
//           res+="TRUE"; 
//        }
//        else{
//            res+="(FALSE";
//        }
//        if(!search.getSearchLanguageInfoRequerimentOrOperatorList().isEmpty()){
//            res+=")"; 
//        }
//        for(SearchLanguageInfoRequerimentOrOperator restriction: search.getSearchLanguageInfoRequerimentOrOperatorList()){
//            res+=" OR(FALSE OR (TRUE";
//            res+=generateSearchLanguageInfoRequerimentOrOperatorSQL(restriction);
//            res+="))";
//        }
//        res+=")";
        return res;
    }
    
    private String generateSearchLanguageInfoRequerimentOrOperatorSQL(SearchLanguageInfoRequerimentOrOperator restr){
        String result="";
//        if(restr.getLanguage()!=null){
//            result+=" AND candidate_language_info.LANGUAGE="+restr.getLanguage().getIdLanguage();
//        }
//        if(restr.getMinimumLanguageLevel()!=null){
//            result+=" AND language_level.VALUE>="+restr.getMinimumLanguageLevel().getValue();
//        }
//        if(restr.getRequiredVideo()!=null && restr.getRequiredVideo()==true){
//            result+=" AND candidate_language_info.VIDEO IS NOT NULL";
//        }
        return result;
    }
}
